﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBTMDT.Dal;

namespace DBTMDT.Biz
{
    class BizLichSuBid
    {
        public int IdLichSuBid { get; set; }
        public string MaLichSuBid { get; set; }
        public DateTime ThoiGianBid { get; set; }
        public decimal GiaLucBid { get; set; }
        public int LuongBidTieuHao { get; set; }
        public BizPhienDau IdPhienDau { get; set; }
        public BizUser IdUser { get; set; }

        public BizLichSuBid()
        {
            this.IdLichSuBid = -1;
            this.IdPhienDau = new BizPhienDau();
            this.IdUser = IdUser;
        }


        public BizLichSuBid(int IdLichSuBid, string MaLichSuBid, DateTime ThoiGianBid, decimal GiaLucBid,
            int LuongBidTieuhao, BizPhienDau IdPhienDau, BizUser IdUser
            )
        {
            this.IdLichSuBid = IdLichSuBid;
            this.MaLichSuBid = MaLichSuBid;
            this.ThoiGianBid = ThoiGianBid;
            this.GiaLucBid = GiaLucBid;
            this.LuongBidTieuHao = LuongBidTieuHao;
            this.IdPhienDau = IdPhienDau;
            this.IdUser = IdUser;
        }

        public BizLichSuBid( string MaLichSuBid, DateTime ThoiGianBid, decimal GiaLucBid,
            int LuongBidTieuhao, BizPhienDau IdPhienDau, BizUser IdUser
            )
        {
           
            this.MaLichSuBid = MaLichSuBid;
            this.ThoiGianBid = ThoiGianBid;
            this.GiaLucBid = GiaLucBid;
            this.LuongBidTieuHao = LuongBidTieuHao;
            this.IdPhienDau = IdPhienDau;
            this.IdUser = IdUser;
        }


        public void Save()
        {
            if (this.IdLichSuBid == -1)
                this.IdLichSuBid = DalLichSuBid.Insert(this);
            else
                DalLichSuBid.Update(this);
        }


    }


}
